﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Microhard.Permission.Interface;
using Microhard.WarehouseInsp.Buz.Models;
using Microhard.WarehouseInsp.Buz.Interfaces;
using Microsoft.Practices.Unity;
using Microhard.Workflow;
using Microhard.WarehouseInsp.Buz.JHWorkflow;
using FluentValidation.Mvc;
using System.IO;
using Microhard.Permission.MVCFilter;
using Microhard.WebUI.Models;
using Microhard.Core;
using Microhard.WarehouseInsp.Buz.Impls;
using Telerik.Web.Mvc;

namespace Microhard.WarehouseInsp.WebUI.Areas.WarehouseInsp.Controllers
{
    public class WarehouseController : MicroHardBaseController<WarehouseModel>
    {

        private IWarehouse _resp = null;
        [Dependency]
        public IWarehouse Category
        {
            set
            {
                base._repository = value;
                _resp = value;
            }
            get
            {
                return _resp;
            }
        }

        [MVCFilterAtrForLogon()]
        public ActionResult GetWarehouseList(AttriubteOfSelectList ctrAttr)
        {
            var comp = _resp.GetAllWarehouse();
            ctrAttr.Data = comp.Select(r => new SelectData
            {
                ID = r.WarehouseID.ToString(),
                Name = r.Name
            }).ToList();
            return View("SelectList", ctrAttr);
        }

    }
}
